import {
  getData,
  postData,
  putData,
  deleteData,
} from "@/api/common/index";

const baseUserVirtualCallConfigInfo = "/api/user-virtual-call-config-info";

const UserVirtualCallConfigInfoUrl = {
  page: "/page",
  url: "",
};

export function getUserVirtualCallConfigInfoPage(params: any, pageNo: number | null | undefined, pageSize : number | null| undefined): Promise<any> {
  let url = baseUserVirtualCallConfigInfo + UserVirtualCallConfigInfoUrl.page + "?pageNum=" + (pageNo ? pageNo : 1) + "&pageSize=" + (pageSize ? pageSize : 10);
  return postData(url, params);
}

export function getUserVirtualCallConfigInfoDetail(id: number): Promise<any> {
  return getData(baseUserVirtualCallConfigInfo + UserVirtualCallConfigInfoUrl.url + "?id=" + id);
}

export function deleteUserVirtualCallConfigInfo(ids: string) : Promise<any>{
  return deleteData(baseUserVirtualCallConfigInfo + UserVirtualCallConfigInfoUrl.url + "?ids=" + ids);
}

export function addOrEditUserVirtualCallConfigInfo(
  method: string,
  params: any
): Promise<any> {
  if ("put" == method) {
    return putData(baseUserVirtualCallConfigInfo + UserVirtualCallConfigInfoUrl.url, params);
  } else {
    return postData(baseUserVirtualCallConfigInfo +  UserVirtualCallConfigInfoUrl.url, params);
  }
}
